Component({
  properties: {
    label: String,
    maxlength: {
      type: Number,
      value: 140
    },
    disabled: Boolean,
    type: {
      type: String,
      value: 'text'
    },
    password: Boolean,
    myValue: String,
    placeholder: String,
    required: Boolean,
    labelWidth: {
      type: String,
      value: 170
    },
    style: String
  },
  methods: {
    tap() {
      // this.triggerEvent('focus', true)
    },
    update: function () {
      this.setData({
        myValue: 'leaf'
      })
    },
    input(e) {
        let { value } = e.detail
        const { type } = this.properties
        if (type === 'number') {
          const reg = /[^\d]/g
          value = value.replace(reg, '')
        }
        this.setData({
          myValue: value
        })
        return value
    }
  }
})
